package com.example.yyjc.service.impl;

import com.example.yyjc.domain.countryanalyze.CountryAnalysisReport;
import com.example.yyjc.domain.industryanalyze.IndustryAnalysisReport;
import com.example.yyjc.domain.selectionanalyze.SelectionAnalysisReport;
import com.example.yyjc.mapper.ReportMapper;
import com.example.yyjc.service.ReportService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName ReportServiceImpl
 * @Description TODO
 * @Author lvyongwei
 * @Date 2020-12-16 14:07
 **/
@Service
public class ReportServiceImpl implements ReportService {

    @Autowired
    private ReportMapper reportMapper;

    /**
     * 添加国家分析实验报告
     * @param countryAnalysisReport
     * @return
     */
    @Override
    public boolean insertCountryAnalysisReport(CountryAnalysisReport countryAnalysisReport) {
        return reportMapper.insertCountryAnalysisReport(countryAnalysisReport);
    }

    /**
     * 用户查看自己实验报告
     * @param userId
     * @param data
     * @return
     */
    @Override
    public List<CountryAnalysisReport> getCountryAnalysisReports(Integer userId,String data,String userName) {
        return reportMapper.getCountryAnalysisReports(userId,data,userName);
    }

    /**
     * 根据实验报告id查询实验报告
     * @param countryAnalysisId
     * @return
     */
    @Override
    public CountryAnalysisReport getCountryAnalysisReport(Long countryAnalysisId) {
        return reportMapper.getCountryAnalysisReport(countryAnalysisId);
    }

    /**
     * 根据实验报告id删除实验报告
     * @param countryAnalysisId
     * @return
     */
    @Override
    public boolean deleteCountryAnalysisReport(Long countryAnalysisId) {
        return reportMapper.deleteCountryAnalysisReport(countryAnalysisId);
    }

    /**
     * 用户提交实验报告
     * @param industryAnalysisReport
     * @return
     */
    @Override
    public boolean insertIndustryAnalysis(IndustryAnalysisReport industryAnalysisReport) {
        return reportMapper.insertIndustryAnalysisReport(industryAnalysisReport);
    }

    /**
     * 用户查看自己的实验报告
     * @param userId
     * @param data
     * @return
     */
    @Override
    public List<IndustryAnalysisReport> getIndustryAnalysisReports(Integer userId,String data,String userName) {
        return reportMapper.getIndustryAnalysisReports(userId,data,userName);
    }

    /**
     * 根据实验报告id删除实验报告
     * @param industryAnalysisId
     * @return
     */
    @Override
    public boolean deleteIndustryAnalysisReport(Long industryAnalysisId) {
        return reportMapper.deleteIndustryAnalysisReport(industryAnalysisId);
    }

    /**
     * 添加选品分析实验报告
     * @param selectionAnalysisReport
     * @return
     */
    @Override
    public boolean insertSelectionAnalysisReport(SelectionAnalysisReport selectionAnalysisReport) {
        return reportMapper.insertSelectionAnalysisReport(selectionAnalysisReport);
    }

    /**
     * 用户查看自己选品分析实验报告
     * @param userId
     * @param data
     * @return
     */
    @Override
    public List<SelectionAnalysisReport> getSelectionAnalysisReports(Integer userId,String data,String userName) {
        return reportMapper.getSelectionAnalysisReports(userId,data,userName);
    }

    /**
     * 删除选品分析实验报告
     * @param selectionAnalysisId
     * @return
     */
    @Override
    public boolean deleteSelectionAnalysisReport(Long selectionAnalysisId) {
        return reportMapper.deleteSelectionAnalysisReport(selectionAnalysisId);
    }
}
